package cn.sccl.dirms.topo.discovery.model;

import cn.sccl.common.exception.BusinessException;
import cn.sccl.common.model.BaseModel;

/**
* 自动发现规则
* 数据库表 T_TOPO_DISCOVER_TASK_LOG 的实体对象
* Created by _minus on 2017-10-09.
*/
public class DiscoverTaskLog extends BaseModel{
   /**
   *表名
   */
   public final static String TABLE_NAME ="t_topo_discover_task_log";

    private String taskId;//任务id
    private String type;//日志类型
    private String message;//信息
    private String ip;//ip地址
    private String userId;//数据创建者
    private String graphyId;//topo图id
    private String nodeId;//录入资源数据库的nodeid

    private String taskQueueId;//任务队列的id

    private String taskFireLogId;//所属任务日志id

    public void setTaskId(String taskId){
        this.taskId = taskId;
    }

    public String getTaskId(){
        return this.taskId;
    }
    public void setType(String type){
        this.type = type;
    }

    public String getType(){
        return this.type;
    }
    public void setMessage(String message){
        this.message = message;
    }

    public String getMessage(){
        return this.message;
    }
    public void setIp(String ip){
        this.ip = ip;
    }

    public String getIp(){
        return this.ip;
    }
    public void setUserId(String userId){
        this.userId = userId;
    }

    public String getUserId(){
        return this.userId;
    }
    public void setGraphyId(String graphyId){
        this.graphyId = graphyId;
    }

    public String getGraphyId(){
        return this.graphyId;
    }
    public void setNodeId(String nodeId){
        this.nodeId = nodeId;
    }

    public String getNodeId(){
        return this.nodeId;
    }
    public void setTaskQueueId(String taskQueueId){
        this.taskQueueId = taskQueueId;
    }

    public String getTaskQueueId(){
        return this.taskQueueId;
    }
    public void setTaskFireLogId(String taskFireLogId){
        this.taskFireLogId = taskFireLogId;
    }

    public String getTaskFireLogId(){
        return this.taskFireLogId;
    }

    /**
    * clone一个对象。
    * @param cls 需要克隆的对象类型，只能是当前类的子类
    * @param <T>
    * @return
    * @throws IllegalAccessException
    * @throws InstantiationException
    */
    public <T extends DiscoverTaskLog> T clone(Class<T> cls) {
       try {
          T t = cls.newInstance();
          t.setId(this.getId());
          t.setDeleteFlag(this.isDeleteFlag());
          t.setCreateTime(this.getCreateTime());
          t.setUpdateTime(this.getUpdateTime());
          /*t.setPosition(this.getPosition());
          t.setUpdateUser(this.getUpdateUser());
          t.setCreateUser(this.getCreateUser());*/
          t.setTaskId(this.getTaskId());
          t.setType(this.getType());
          t.setMessage(this.getMessage());
          t.setIp(this.getIp());
          t.setUserId(this.getUserId());
          t.setGraphyId(this.getGraphyId());
          t.setNodeId(this.getNodeId());
          t.setTaskQueueId(this.getTaskQueueId());
          t.setTaskFireLogId(this.getTaskFireLogId());
          return t;
       } catch (Exception e) {
          e.printStackTrace();
          throw new BusinessException("对象克隆失败，请克隆的目标对象是否具有无参的构造函数。", e.getCause());
       }
    }
}